home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 101 / Ultra Game Players Magazine, No. 101 - September 1997 (Imagine Publishing, Inc.)(1997).iso / pc / new_ugp.dxr / 00284_Scroll Banner Class.ls < prev    next >
Encoding:
Text File  |  1997-07-10  |  2.0 KB  |  72 lines

  1. property timeLimit, lastAction, spritenum, bannerHeight, scrollRate, button
  2.  
  3. on new me, params
  4.   set button to getProp(params, #button)
  5.   set spritenum to getProp(params, #spritenum)
  6.   set scrollRate to getProp(params, #scrollRate)
  7.   set timeLimit to getProp(params, #timeLimit) * 60
  8.   set lastAction to the ticks
  9.   set bannerHeight to the height of member the memberNum of sprite spritenum
  10.   puppetSprite(spritenum, 1)
  11.   ResetPos(me)
  12.   return me
  13. end
  14.  
  15. on CheckIdle me
  16.   set currTime to the ticks
  17.   set lastSysClick to currTime - the lastClick
  18.   if lastSysClick > lastAction then
  19.     put "New click"
  20.     set lastAction to lastSysClick
  21.   end if
  22.   set titleObj to GetGlobal(#gTitleObject)
  23.   set menuObj to the currMenu of titleObj
  24.   set videoDisplay to the videoDisplay of menuObj
  25.   if objectp(videoDisplay) then
  26.     if the movieRate of sprite the spritenum of videoDisplay <> 0 then
  27.       set lastAction to currTime
  28.     end if
  29.   end if
  30.   set currLoc to the locV of sprite spritenum
  31.   set bannerTopPos to 480 - (bannerHeight / 2)
  32.   set bannerBottomPos to 480 + (bannerHeight / 2)
  33.   if (currTime - lastAction) > timeLimit then
  34.     if currLoc > bannerTopPos then
  35.       set currLoc to currLoc - scrollRate
  36.     end if
  37.   else
  38.     if currLoc < bannerBottomPos then
  39.       set currLoc to currLoc + scrollRate
  40.     end if
  41.   end if
  42.   if currLoc < bannerTopPos then
  43.     set currLoc to bannerTopPos
  44.   end if
  45.   if currLoc > bannerBottomPos then
  46.     set currLoc to bannerBottomPos
  47.   end if
  48.   set the locV of sprite spritenum to currLoc
  49. end
  50.  
  51. on ResetPos me
  52.   set bannerBottomPos to 480 + (bannerHeight / 2)
  53.   set the locV of sprite spritenum to bannerBottomPos
  54. end
  55.  
  56. on ChangeAd me, memNum
  57.   if objectp(button) then
  58.     set dest to the name of member memNum
  59.     set the destination of button to dest
  60.     set the statusMessage of the statusMessage of button to "More about" && dest
  61.   end if
  62.   if stringp(memNum) then
  63.     set memNum to the number of member memNum
  64.   end if
  65.   set bannerHeight to the height of member memNum
  66.   set the memberNum of sprite spritenum to memNum
  67.   ResetPos(me)
  68. end
  69.  
  70. on dispose me
  71. end
  72.